<template>
  <div>
    <div class="none" v-if="misson.length == 0">
      <img src="../../assets/不存在.png" alt="" />
      <p>无在途任务</p>
    </div>
    <main>
      <div v-for="(item, index) in misson" :key="index" class="task-dialog">
        <SDialog :misson="item" :type="item.type"></SDialog>
        <div class="bottom">
          <div class="time">
            <p v-html="item.info == '0' ? '提货时间' : '交货时间'"></p>
            <p>{{ item.time }}</p>
          </div>
          <div class="btn">
            <van-button type="danger" round v-if="item.info == '0'"
              >交付</van-button
            >
            <van-button
              type="danger"
              round
              v-if="item.info == '1'"
              @click="carback(item)"
              >回车登记</van-button
            >
          </div>
        </div>
      </div>
    </main>
  </div>
</template>
<script>
import SDialog from "@/components/SDialog.vue";
export default {
  name: "TaskList",
  components: {
    SDialog,
  },
  data() {
    return {
      misson: [
        {
          number: "XAHH1234567",
          start: "北京市昌平区回龙观街道西三旗桥东金燕龙写字楼8877号",
          end: "河南省郑州市路北区北清路99号",
          type: "1",
          info: "0",
          time: "2022.05.04 13:00",
        },
        {
          number: "XAHH1234567",
          start: "北京市昌平区回龙观街道西三旗桥东金燕龙写字楼8877号",
          end: "河南省郑州市路北区北清路99号",
          type: "1",
          info: "1",
          time: "2022.05.04 13:00",
        },
        {
          number: "XAHH1234567",
          start: "北京市昌平区回龙观街道西三旗桥东金燕龙写字楼8877号",
          end: "河南省郑州市路北区北清路99号",
          type: "1",
          info: "1",
          time: "2022.05.04 13:00",
        },
      ],
    };
  },
  created() {},
  computed: {},
  methods: {
    carback(item) {
      this.$router.push({
        path: "/carback",
        query: {
          time: item.time,
        },
      });
    },
  },
};
</script>
<style lang="less" scoped>
.none {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  img {
    width: 200px;
    height: 120px;
    margin-bottom: 20px;
  }
  p {
    width: 91px;
    height: 22px;
    font-weight: 400;
    font-size: 16px;
    color: #818181;
    letter-spacing: 0.18px;
    text-align: center;
  }
}
main {
  // padding-bottom: 82px;
  background-color: #f4f4f4;
  // padding-top: 93px;
  padding-bottom: 15px;
  width: 375px;
  // height: 812px;
  .task-dialog {
    position: relative;
    width: 345px;
    height: 229px;
    margin-bottom: 15px;
    /deep/.number span {
      font-size: 16px;
      font-weight: 700;
      color: #2a2929;
    }
    .bottom {
      position: absolute;
      bottom: 0;
      left: 15px;
      width: 345px;
      height: 56px;
      padding: 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      background-color: #fff;
      border-radius: 0px 0px 10px 10px;
      .time {
        p {
          font-size: 14px;
          &:first-child {
            color: #818181;
          }
          &:last-child {
            color: #2a2929;
          }
        }
      }
      .btn {
        button {
          width: 80px;
          height: 32px;
          white-space: nowrap;
        }
      }
    }
  }
}
</style>
